C code for getting error codes and error strings

Retrieving Report Engine error codes and errors is an important task in creating successful Report Engine applications. Use the following code for PEGetErrorCode and PEGetErrorText as an example of how to handle errors:

short            errorCode;
HANDLE    errorHandle;
short        errorLength;
char        *errorString;
errorCode = PEGetErrorCode(Job);
if (errorCode < 0){
    // Handle error
} else {
    if (errorCode = 0){ // No error }
}
if (!PEGetErrorText(Job, &errorHandle, &errorLength)){
    // Handle error
}
    // Allocate string buffer
errorString = (char*)malloc(errorLength);
    // Retrieve error string
if (!PEGetHandleString(errorHandle, errorString, errorLength)){
    // Handle error
}



Seagate Software IMG Holdings, Inc.
http://www.seagatesoftware.com
Support services:
http://support.seagatesoftware.com